package com.spzx.product.controller;

import com.spzx.common.core.domain.R;
import com.spzx.common.core.web.controller.BaseController;
import com.spzx.common.security.annotation.InnerAuth;
import com.spzx.product.api.vo.SkuLockVo;
import com.spzx.product.service.ISkuStockService;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 商品sku库存表 前端控制器
 * </p>
 *
 * @author atguigu
 * @since 2024-12-19
 */
@RestController
@RequestMapping("/skuStock")
public class SkuStockController extends BaseController {

    @Autowired
    private ISkuStockService skuStockService;


    @InnerAuth
    @Operation(summary = "检查与锁定库存")
    @PostMapping("/checkAndLock/{orderNo}")
    public R<String> checkAndLock(@PathVariable String orderNo, @RequestBody List<SkuLockVo> skuLockVoList) {
        return R.ok(skuStockService.checkAndLock(orderNo, skuLockVoList));
    }
}
